UNPKG

@lobehub/chat

Version:

Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.

20 lines (14 loc) 484 B
import { useEffect, useState } from 'react'; import { isOnServerSide } from '@/utils/env'; import { SCROLL_PARENT_ID } from '../../features/const'; export const useScrollParent = () => { const [parent, setParent] = useState<HTMLDivElement>(); useEffect(() => { if (isOnServerSide) return; const scrollParent = document.querySelector(`#${SCROLL_PARENT_ID}`); if (scrollParent) { setParent(scrollParent as HTMLDivElement); } }, []); return parent; };